home *** CD-ROM | disk | FTP | other *** search
/ Know Your Baseball - The Greatest Player Resource / Know Your Baseball - Greatest Player.iso / Baseball / Director / KTGCST.CST / 00097_Script_ButtonsObject < prev    next >
Text File  |  1998-09-21  |  2KB  |  91 lines

  1. property LastSelected,NowOn
  2.  
  3. on new me,which
  4.   set NowOn = []
  5.   set lastSelected = []
  6.   return me
  7. end
  8.  
  9. --which = sprite channel
  10. -- type-- annimation behavoiur 
  11. --1 no mousedown screen state
  12. --2 mousedown screen state
  13. -- action -- handler name or go to X
  14. -- clickit = puppetsound that you wantplayed for button click
  15.  
  16. global gButtonState
  17.  
  18. on button me, which,type,action,MB,Clickit
  19.   if voidp(MB) then put mousecast() into MB
  20.   if voidp(Clickit) = 0 then
  21.     puppetsound 0
  22.     puppetsound Clickit
  23.     updatestage
  24.   end if  
  25.   puppetsprite which,1  
  26.   -- behave according to type required
  27.   case type of
  28.       
  29.     1:  -- non sticky button does action on mousedown
  30.       losepop(window "pop")
  31.       repeat while stilldown()=1
  32.         if mousecast()= MB then
  33.           set the membernum of sprite which to MB+1
  34.           set the blend of sprite which = 100
  35.           updatestage
  36.           next repeat
  37.         end if
  38.         --return to normal whem off button
  39.         if (mousecast() <>MB+1)then 
  40.           set the membernum of sprite which to MB
  41.           set the blend of sprite which = 0
  42.         end if
  43.         updatestage
  44.         if rollOver(which) then
  45.           do action
  46.         end if
  47.       end repeat
  48.       set the membernum of sprite which to MB 
  49.     2:  
  50.       -- threestate button that sticks 
  51.       set clicked = getat(gbuttonstate,which)
  52.       if clicked = 0 then 
  53.         
  54.         repeat while stilldown()=1  
  55.           if mousecast()= MB then 
  56.             set the membernum of sprite which = MB+1
  57.             set the blend of sprite which = 100
  58.             updatestage
  59.           end if
  60.           --return to normal whem off button
  61.           if (mousecast() <>MB+1)then  
  62.             set the member of sprite which to MB
  63.             set the blend of sprite which = 0
  64.             updatestage
  65.           end if 
  66.         end repeat
  67.       else
  68.         puppetsound 0
  69.         losepop(window "pop")
  70.         setat(gbuttonstate,clickon(),0)
  71.         set the membernum of sprite which = MB
  72.         updatestage
  73.         exit
  74.       end if
  75.       if rollOver(which) then
  76.         puppetsound 0
  77.         set the membernum of sprite which = MB+1
  78.         setat(gbuttonstate,which,2)
  79.         updatestage
  80.         do action
  81.       end if
  82.   end case
  83. end
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.